package com.googlecode.garbagecan.commons.clistudy.license;

import java.io.PrintWriter;
import java.io.StringWriter;

import org.apache.commons.cli.HelpFormatter;

public class CheckoutHelpCommand implements Command {

	public String execute() {
		StringWriter sw = new StringWriter();
		PrintWriter pw = new PrintWriter(sw);

		String cmd = "checkout";
		CheckoutCommandParser parser = new CheckoutCommandParser();
		HelpFormatter formatter = new HelpFormatter();
		formatter.setSyntaxPrefix("Usage: ");
		formatter.printHelp(pw, 80, cmd, "Options:", parser.getOptions(), 2, 4, "", true);
		StringBuffer sb = new StringBuffer();
		sb.append("\n");
		sb.append(sw.getBuffer());
		sb.append("\n");
		System.out.println(sb.toString());
		return CMD_SUCCESS;
	}

}
